
 
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
 
 
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class PictueFrame extends JFrame implements Runnable {
    JPanel contentPane;
    JLabel jLabel1 = new JLabel();
    boolean packFrame = false;
    public PictueFrame() {
        try {
            Thread thre = new Thread(this);
            thre.start();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
 
    /**
     * Component initialization.
     *
     * @throws java.lang.Exception
     */
    private void jbInit() throws Exception {
 
    }
 
    public void run() {
 
        contentPane = (JPanel) getContentPane();
        contentPane.setLayout(null);
        setSize(new Dimension(1024, 768));
        setTitle("Frame Title");
        this.setUndecorated(true);
        this.setResizable(false);
 
        jLabel1.setBounds(new Rectangle(9, 9, 1024, 768));
        jLabel1.setIcon(new ImageIcon(PictueFrame.class.getResource(
                "sky.jpg")));
        contentPane.add(jLabel1);
        if (packFrame) {
            this.pack();
        } else {
            this.validate();
        }
 
        int height = 300;
        int width = 100;
        try {
            while (true) {
                Thread.currentThread().sleep(1);
                this.setSize(new Dimension(height, width));
                this.setBackground(Color.BLUE);
                Dimension screenSize = Toolkit.getDefaultToolkit().
                                       getScreenSize();
                Dimension frameSize = this.getSize();
                if (frameSize.height > screenSize.height) {
                    frameSize.height = screenSize.height;
                }
                if (frameSize.width > screenSize.width) {
                    frameSize.width = screenSize.width;
                    this.dispose();
                    break;
                }
                this.setLocation((screenSize.width - frameSize.width) / 2,
                                 (screenSize.height - frameSize.height) / 2);
                this.show();
                height = height + 6;
                width = width + 10;
 
            }
        } catch (HeadlessException ex) {
            ex.printStackTrace();
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
 
    }
}
 